package com.spring3;

import com.spring301.DemoService301;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 *  spring 3.*
 *    3.0 @Configuration 取代xml的配置方式
 *      但还是依赖于 <context:component-scan base-package="com"/>
 *      @ImportResource
 *
 *    3.1 版本出现 @ComponentScan   完全不需要xml了
 *
 */
public class Demo03 {

    public static void main(String[] args) {
//        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfiguration.class);
//        Demo03Service bean = context.getBean(Demo03Service.class);
//        System.out.println(bean);
        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfiguration02.class);
        Demo03Service bean = context.getBean(Demo03Service.class);
        DemoService301 bean1 = context.getBean(DemoService301.class);
        System.out.println(bean1);
    }
}
